package com.collect.cameroon.zhiAdater.zhiAuditerPerfermance;

import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.collect.cameroon.R;
import com.collect.cameroon.zhiBean.zhiReceive.ZHIRAuditerWholeKfMonthBonusDetailEntity;

public class ZHIAuditerPerfermanceMonth extends BaseQuickAdapter<ZHIRAuditerWholeKfMonthBonusDetailEntity, BaseViewHolder> {

    private ZHIAuditerPerfermanceMonthClickListener mZHIAuditerPerfermanceMonthClickListener;

    public ZHIAuditerPerfermanceMonth() {
        super(R.layout.item_level_detail_column_3, null);
    }

    @Override
    protected void convert(BaseViewHolder helper, ZHIRAuditerWholeKfMonthBonusDetailEntity item) {
        helper.setText(R.id.tv_col_0, item.getBonusDate());
        helper.setText(R.id.tv_col_1, item.getBonusAmount() + "");
        helper.setText(R.id.tv_col_2, item.getPenaltyAmount() + "");

        TextView tv_col_0 = helper.getView(R.id.tv_col_0);
        TextView tv_col_1 = helper.getView(R.id.tv_col_1);
        TextView tv_col_2 = helper.getView(R.id.tv_col_2);

        tv_col_0.setOnClickListener(v -> {
            if (mZHIAuditerPerfermanceMonthClickListener != null) {
                mZHIAuditerPerfermanceMonthClickListener.onItemClick(item);
            }
        });

        tv_col_1.setOnClickListener(v -> {
            if (mZHIAuditerPerfermanceMonthClickListener != null) {
                mZHIAuditerPerfermanceMonthClickListener.onItemClick(item);
            }
        });

        tv_col_2.setOnClickListener(v -> {
            if (mZHIAuditerPerfermanceMonthClickListener != null) {
                mZHIAuditerPerfermanceMonthClickListener.onItemClick(item);
            }
        });
    }

    public void setColumnItemClick(ZHIAuditerPerfermanceMonthClickListener listener) {
        mZHIAuditerPerfermanceMonthClickListener = listener;
    }

    public interface ZHIAuditerPerfermanceMonthClickListener {
        void onItemClick(ZHIRAuditerWholeKfMonthBonusDetailEntity item);
    }
}
